package main

import "fmt"

type Person6 struct {
	name string
	age  int
}

type Student6 struct {
	Person6
	xuehao int
}
type Teacher6 struct {
	Person6
	bainhao int
}

type humenMoves interface {
	say()
	jump()
}

//多态方法 理解:给类的指针绑定的方法
func (t *Student6) say() {
	fmt.Println("Student6 say")
}
func (t *Student6) jump() {
	fmt.Println("Student6 jump")
}

//多态方法
func (t *Teacher6) say() {
	fmt.Println("Teacher6 say")
}
func (t *Teacher6) jump() {
	fmt.Println("Teacher6 jump")
}
func whosay(i humenMoves) {
	fmt.Println("all in who say jump")
	i.say()
	i.jump()
}
func main() {
	stu1 := Student6{Person6{"hi", 20}, 2}
	tea1 := Teacher6{Person6{"tea", 30}, 1}
	stu1.say()
	tea1.say()

	//多态方法 理解:给类的指针绑定的方法 所以要取址
	stu2 := &Student6{Person6{"hi", 20}, 2}
	tea2 := &Teacher6{Person6{"tea", 30}, 1}

	whosay(stu2)
	whosay(tea2)
}
